#ifndef __PWD_H__
#define __PWD_H__

int platform_pmd_poweron_system(int simStartUpMode,int nwStartupMode);
int platform_pmd_poweroff_system();
int platform_pmd_enter_deepsleep(int enter);

typedef struct BatteryInfo_t{
    int battStatus;
    int battVolt;
    int battLevel;
    int chargerStatus;
    int chargeState;
}BatteryInfo;

int platform_get_battery_info(BatteryInfo* pBatteryInfo);

typedef struct PmdConfig_t{
    char batdetectEnable;
    char tempdetectEnable;
    int templowLevel;
    int temphighLevel;
    char batLevelEnable;
}PmdConfig;

typedef enum{
    INVALID = 0,
    CHR_PRESENT_IND = 1,
    BAT_PRESENT_IND = 2,
    BAT_LEVEL_IND = 3,
    BAT_VOLT_LOW = 4,
    BAT_OVERVOLT = 5,
    BAT_CHARGING = 6,
    BAT_CHR_FULL = 7,
    BAT_RECHARGING = 8,
    BAT_RECHR_FULL = 9,
    BAT_CHR_STOP = 10,
    BAT_CHR_ERR = 11,
    POWERON_ON_IND = 12,
    GPIO_INT_IND = 13,
    LCD_REFRESH_REQ = 14,
    VIDEORECORD_FINISH_IND = 15,
    CAMERA_DATA_IND = 16,
    VIDEO_PLAY_FINISH_IND = 17,
    VIDEO_CURRENT_TIME_IND = 18,
    UART_RX_DATA_IND = 19,
    UART_TX_DONE_IND = 20,
    ALARM_IND = 21,
    SW_AUTO_VERIFY_IND = 22,
}PmdEvent;

typedef enum {
  BY_KEY = 1,     /* 按键开机 */
  BY_CHARGER = 2, /* 充电开机 */
  BY_ALARM = 3,   /* 闹钟开机 */
  BY_RESET = 4,   /* 软件重启开机 */ 
  BY_EXCEPTION = 5, /* 异常重启 */ 
  BY_PIN_RESET = 6, /* reset 键重启 */
}POWERON_REASON;

typedef struct PmdEventParam_t{
    PmdEvent evtId;
    union 
    {
        struct{
            char present;//1 present,0 not present
        }ChargerPresent;
        struct{
            char batteryLevel;  /*0-100 %*/
        }batlevelind,batovervoltind,chargingind,chrfullind,rechargingind,rechrfullind;
        struct{
            POWERON_REASON powerOnReason;
        }poweronind;        
    };
}PmdEventParam;


typedef void(*PMD_EVT_CALLBACK)(PmdEventParam* param);
int platform_pmd_init(int mode,PmdConfig* cfg,PMD_EVT_CALLBACK cb,void* udata);
#endif //__PWD_H__